function FormatState(val,row,index) {
    if(val=='0'){
        return "暂存";
    }else if(val=='1'){
        return "未处理";
    }else if(val=='2'){
        return "已处理";
    }
}
function FormatOperation(value,row,index){
    var peration ="";
    if(value=='0'){
        peration="<span class='btn btn-default' onclick='updateApplyMaster("+JSON.stringify(row)+")'><i class='glyphicon glyphicon-edit'></i>修改</span>";
    }else{
        peration="<span class='btn btn-default' onclick='ApplyMaster("+JSON.stringify(row)+")'><i class='glyphicon glyphicon-info-sign'></i>详情</span>";
    }
    return peration;
}
function ApplyMaster(row){
    console.info(row)
    location="apply/handApply/to?applyMasterId="+row.applyMasterId;
   /* $.post("apply/handApply/searchByApplyChild",param,function (result) {
        console.info(result)
        $.each(result,function(){
            alert("s")
            var i =this.applySource;
            var sources="";
            switch (i){
                case '0':
                    sources="科室白支票";
                    break;
                case '1':
                    sources="科研经费";
                    break;
                case '2':
                    sources="教育经费";
                    break;
            }
                var opt ="<tr><td>"+this.applyChildId+"</td>"+
            "<td>"+this.cgCode+"</td>"+
            "<td>"+this.dictionary.cgName+"</td>"+
            "<td>"+this.dictionary.spec+"</td>"+
            "<td>"+this.dictionary.unit+"</td>"+
            "<td>"+this.dictionary.type==0?'低值':'高值'+"</td>"+
            "<td>"+this.applyChildTreatmentNu+"</td>"+
            "<td>"+sources+"</td>"+
            "<td>"+this.createBy+"</td>"+
            "<td>"+this.department.departmentName+"</td>"+
            "<td>"+this.createDate+"</td></tr>";
            $("#am").append(opt);
        })
        $(".modal .modal-body #ApplyMaster").attr("class","show");
        $("#ApplyMaster").dialog("open");
    },'json')*/
}
function searchTjApplyMaster() {
    var param=$("#condition").serializeArray();
    console.info(param)

    var obj={};
    for(var i in param){
        obj[param[i].name]=param[i].value;
    }
    $("#table").bootstrapTable("refresh",{query:obj});

}
function FormatDepartment(val,row,index){
    var name=null;
    $.ajax({
        url:'sys/department/searchByDepartment',
        data:"id="+val,
        dataType:'json',
        type:'post',
        async:false,
        success:function (result) {
            name= result.departmentName;
        }
    });
    return name;
}




function addApplyMaster() {
    alert("s")
    $.post("apply/handApply/addApplyMaster",function (result) {
        location="apply/handApply/to2?applyMasterId="+result.applyMasterId+"&applyMasterNo="+result.applyMasterNo;
    },'json')
}

function  updateApplyMaster(row) {
    location="apply/handApply/to2?applyMasterId="+row.applyMasterId+"&applyMasterNo="+row.applyMasterNo;
    console.info(row);
}
